import { get, post, put, del } from '@/utils/request'

export const http = {
  notice: {
    list: (params) => get('/notice/list', params),
    page: (params) => get('/notice', params),
    read: (id) => get('/notice' + id),
    create: (id, data) => post('/notice', {}, data),
    update: (id, data) => put('/notice/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/notice/' + id)
  },
  calendar: {
    list: (params) => get('/calendar/list', params),
    page: (params) => get('/calendar', params),
    read: (id) => get('/calendar' + id),
    create: (id, data) => post('/calendar', {}, data),
    update: (id, data) => put('/calendar/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/calendar/' + id)
  },
  exam: {
    list: (params) => get('/exam/list', params),
    page: (params) => get('/exam', params),
    read: (id) => get('/exam' + id),
    create: (id, data) => post('/exam', {}, data),
    update: (id, data) => put('/exam/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/exam/' + id)
  },
  _class: {
    list: (params) => get('/class/list', params),
    page: (params) => get('/class', params),
    read: (id) => get('/class' + id),
    create: (id, data) => post('/class', {}, data),
    update: (id, data) => put('/class/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/class/' + id)
  },
  school: {
    list: (params) => get('/school/list', params),
    page: (params) => get('/school', params),
    read: (id) => get('/school' + id),
    create: (id, data) => post('/school', {}, data),
    update: (id, data) => put('/school/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/school/' + id)
  },
  category: {
    list: (params) => get('/category/list', params),
    page: (params) => get('/category', params),
    read: (id) => get('/category' + id),
    create: (id, data) => post('/category', {}, data),
    update: (id, data) => put('/category/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/category/' + id)
  },
  course: {
    list: (params) => get('/course/list', params),
    page: (params) => get('/course', params),
    read: (id) => get('/course' + id),
    create: (id, data) => post('/course', {}, data),
    update: (id, data) => put('/course/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/course/' + id)
  },
  course_start: {
    list: (params) => get('/course_start/list', params),
    page: (params) => get('/course_start', params),
    read: (id) => get('/course_start' + id),
    create: (id, data) => post('/course_start', {}, data),
    update: (id, data) => put('/course_start/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/course_start/' + id)
  },
  course_student: {
    list: (params) => get('/course_student/list', params),
    page: (params) => get('/course_student', params),
    read: (id) => get('/course_student' + id),
    create: (id, data) => post('/course_student', {}, data),
    update: (id, data) => put('/course_student/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/course_student/' + id)
  },
  teacher: {
    list: (params) => get('/teacher/list', params),
    page: (params) => get('/teacher', params),
    read: (id) => get('/teacher' + id),
    create: (id, data) => post('/teacher', {}, data),
    update: (id, data) => put('/teacher/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/teacher/' + id)
  },
  student: {
    list: (params) => get('/student/list', params),
    page: (params) => get('/student', params),
    read: (id) => get('/student' + id),
    create: (id, data) => post('/student', {}, data),
    update: (id, data) => put('/student/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/student/' + id),
    updateStatus: (data) => post('/student/updateStatus', {}, data)
  },
  score: {
    page: (params) => get('/score', params),
    read: (id) => get('/score' + id),
    create: (id, data) => post('/score', {}, data),
    update: (id, data) => put('/score/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/score/' + id)
  },
  day: {
    page: (params) => get('/day', params),
    read: (id) => get('/day' + id),
    create: (id, data) => post('/day', {}, data),
    update: (id, data) => put('/day/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/day/' + id)
  },
  ap: {
    page: (params) => get('/ap', params),
    read: (id) => get('/ap' + id),
    create: (id, data) => post('/ap', {}, data),
    update: (id, data) => put('/ap/' + id, {}, { ...data, created_at: undefined, id: undefined }),
    delete: (id) => del('/ap/' + id)
  }
}

